package com.evil.kingdom.handler.timer;

import java.util.Collection;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;

/**
 * 定时-处理器
 *
 * @author liyang
 * @date 2024-06-11 14:39
 */
public class BaseTimerTaskHandler<T> {

    private final List<T> list = new CopyOnWriteArrayList<>();

    protected void addTask(T task) {
        list.add(task);
    }

    protected void addTasks(Collection<T> tasks) {
        list.addAll(tasks);
    }

    protected void removeTask(T task) {
        list.remove(task);
    }

    protected List<T> getList() {
        return list;
    }
}
